<template>
  <div class="navMenu">

    <label v-for="(navMenu, index) in navMenus" v-bind:key="index">
      <el-menu-item v-if="navMenu.childs==null&&navMenu.entity&&navMenu.entity.state==='ENABLE'"
                    :key="navMenu.entity.id" :data="navMenu" :index="navMenu.entity.name" :route="navMenu.entity.value">
        <i :class="navMenu.entity.icon"></i>
        <span slot="title" class="item_title">{{navMenu.entity.alias}}</span>
      </el-menu-item>

      <el-submenu v-if="navMenu.childs&&navMenu.entity&&navMenu.entity.state==='ENABLE'"
                  :key="navMenu.entity.id" :data="navMenu" :index="navMenu.entity.name" >
        <template slot="title">
          <i :class="navMenu.entity.icon"></i>
          <span class="item_title"> {{navMenu.entity.alias}}</span>
        </template>
        <NavMenu :navMenus="navMenu.childs"></NavMenu>
      </el-submenu>
    </label>

  </div>
</template>

<script>
export default {
  name: "NavMenu",
  props: ["navMenus"],
  data() {
    return {};
  },
  mounted() {
    // console.log(this.navMenus)
  },
  methods: {}
};
</script>

<style scoped lang="less">
@import url("./../assets/less/color.less");
.navMenu {
  width: 100%;
  height: 100%;
  background: @sideBar !important;
}
.item_title {
  color: #fff;
  background-color: @sideBar !important;
}
</style>
<style lang="less">
@import url("./../assets/less/color.less");
.el-submenu{
  .el-menu-item {
    color: @sideBar !important;
    background-color: transparent !important;
    .item_title{
      background: transparent !important;
    }
    &.is-active{
      color: @sideBarActiveColor !important;
      background-color: @sideBarActiveBg !important;
      .item_title{
        color: @sideBarActiveColor !important;
        background: transparent !important;
      }
    }
  }
  .el-submenu__title {
    background-color: transparent !important;
    color: #eee !important;
    text-align: left !important;
  }
}
</style>
